package com.project.service.impl;

import com.project.bean.CarBean;
import com.project.bean.ManBean;
import com.project.mapper.IManMapper;
import com.project.service.IManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ManServiceImpl implements IManService {
    @Autowired
    private IManMapper mapper;
    @Override
    public void addMan(ManBean man, List<CarBean> carList) {
        mapper.addMan(man);
//        int x = 9 /0;
        mapper.addCarList(man.getId(),carList);
    }

    @Override
    public void del(int id) {
        mapper.del(id);
    }

    @Override
    public List<ManBean> findAll() {
        return mapper.findAll();
    }

    @Override
    public ManBean findById(int id) {
        return mapper.findById(id);
    }
}
